package com.hxzy.user.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.hxzy.user.entity.TmUser;
import com.hxzy.user.mapper.TmUserMapper;
import com.hxzy.user.service.TmUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author mingqian.Wu
 * @since 2023-06-23
 */
@Service
@DataSource(DataSourceType.USERS)
public class TmUserServiceImpl extends ServiceImpl<TmUserMapper, TmUser> implements TmUserService {

    @Override
    public TmUser getUserById(String id) {
        QueryWrapper<TmUser>queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("user_id",id);
       return baseMapper.selectById(id);
    }

    @Override
    public boolean updateStatus(String id,Integer status) {
        TmUser tmUser=new TmUser();
        tmUser.setUserCertification(status);
        UpdateWrapper<TmUser>userUpdate=new UpdateWrapper<>();
        int update = baseMapper.update(tmUser, userUpdate);
        return update>0;
    }
}
